﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.Shell.Interop;

namespace Jwell.Template.App.Utl
{
    public static class VsSolutionExtension
    {
        public static string GetSolutionDirectory(this IVsSolution solution)
        {
            var direactoryPath = string.Empty;
            var filename = string.Empty;
            var configPath = string.Empty;
            var result = solution.GetSolutionInfo(out direactoryPath, out filename, out configPath);
            if (result == VSConstants.S_OK)
            {
                return direactoryPath;
            }
            throw new Exception("获取解决方案目录失败");
        }
    }
}
